import request from '@/utils/request'
import type { LoginForm } from '@/api/user/type'
import { responseType } from '@/api'

enum URL {
  LOGIN = '/login/in',
  LOGOUT = '/login/out',
  USERINFO = '/user/info',
}

const login = (data: LoginForm) => {
  return request.post<any, responseType>(URL.LOGIN, data)
}

const logout = (data: any) => {
  return request.post(URL.LOGOUT, data)
}

const getUserInfo = () => {
  return request.post(URL.USERINFO)
}

export { login, logout }
